package com.example.demo;

import com.example.demo.model.ListConfig;
import com.example.demo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller

public class Test {

    @Value("${server.port}") //读取配置项
    private  String port;

    @ResponseBody  //返回一个非静态页面的数据
    @RequestMapping("/func")  //设置路由地址
    public String  func(){
        return "port: " + port;
    }

    @Autowired
    private Student student;
    @ResponseBody
    @RequestMapping("/getstudent")
    public String getStudent(){
        return "student: " + student;
    }

    @Autowired
    private ListConfig listConfig;

    @ResponseBody
    @RequestMapping("/getlist")
    public String getList(){
        return "name:" + listConfig.getName();
    }
}